package test;

/**
 * 描述：
 *
 * @author hl
 * @version 1.0
 * @date 2020/10/31 12:18
 */
public class Zhishu {
    public static int getPrimeNum(int n){
        int res = 0;
        for (int i = 0; i <= n; i++) {
            if (i == 0 || i == 1) {
                continue;
            }
            boolean flag = true;
            for (int j = 2; j < i; j++) {
                if (i % j == 0) {
                    flag = false;
                }
            }
            if (flag) {
                res += i;
            }
        }
        return res;
    }

    public static void main(String[] args) {
        System.out.println(getPrimeNum(5));
    }
}
